package com.fd.cloud.fdftp.fileHandle;


import com.fd.cloud.fdftp.ftp.FTPUtils;
import com.fd.cloud.fdftp.test.FtpUtil;

import java.io.UnsupportedEncodingException;

public class FileLineDataHandler implements DataProcessHandler {
    private String encode = "GBK";
    @Override
    public void process(byte[] data) {
        try {
            //System.out.println(new String(data,encode).toString());
            //String fileName="/Users/admin/Downloads/filename_1_100000_2.txt";
            String fileName="/app/zwt/filename_1_100000_2.txt";

            //FileTools.writeFile(fileName,data);
            String path="";
            String file=new String(data,encode).toString();
            //Boolean delete=FtpUtil.deleteFile(path,file);
            Boolean delete=FTPUtils.deleteFile(path,file);
            AppendFile.method1(fileName,new String(data,encode).toString()+"====delete-flg"+delete+"====");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}